Imports System.Data.SqlClient

Public Class Functions

    Shared Function SqlReplaceText(ByVal strSql As String) As String
        Dim strFixedSQL As String

        strFixedSQL = Replace(strSql, "'", "")
        strFixedSQL = Replace(strFixedSQL, "[", "")
        strFixedSQL = Replace(strFixedSQL, "%", "")
        'strFixedSQL = Replace(strFixedSQL, "_", "[_]") 
        'some people may have underscores in their email address
        strFixedSQL = Replace(strFixedSQL, "--", "")
        strFixedSQL = Trim(strFixedSQL)

        If strFixedSQL = "" Then
            strFixedSQL = " "
        End If
        'return the fixed sql
        SqlReplaceText = strFixedSQL
    End Function
    Shared Function ReturnStatus(ByVal intStatusID) As String
        Dim strConnection As String = (ConfigurationManager.AppSettings.Item("SQLConnectionString"))
        Dim strSql As String

        strSql = "select StatusDescription from status " & _
       "where status_id = '" & intStatusID & "';"

        Dim dtTT As DataTable
        dtTT = New DataTable
        Dim daTT As SqlDataAdapter

        daTT = New SqlDataAdapter(strSql, strConnection)

        daTT.Fill(dtTT)

        If dtTT.Rows.Count > 0 Then
            Return dtTT.Rows(0).Item(0)
        Else
            Return "0"
        End If
    End Function
End Class
